<div id="existing_resource_area" class="dialog_area" <%= 'style="display:none;"'.html_safe if @resource.errors.any? %>>
  <input type="hidden" name="linked_resource" id="linked_resource" />
  <div id="existing_resource_area_content" class="clearfix">
    <div id="pages_list" class="pages_list">
      <ul class="link_list">
        <% @resources.each do |resource| -%>
          <% resource_linked = ((@resource_id.present? && @resource_id == resource.id) || (params[:current_link].present? && resource.url == params[:current_link])) %>
          <li<%= ' class="linked"'.html_safe if resource_linked %>>
            <%= link_to "#{resource.title} (#{resource.file_name})", path_to_asset(resource.url),
                        :title => t('.link_to_file'),
                        :rel => resource.title,
                        :class => 'page_link',
                        :id => "resource_#{resource.id}" %>
          </li>
        <% end %>
      </ul>
    </div>
  </div>

  <%= will_paginate @resources, :params => params.dup.merge(:action => "insert") %>

  <%= render '/refinery/admin/form_actions', :f => nil,
             :action_name => "insert",
             :submit_button_text => t('.button_text'),
             :hide_cancel => false,
             :hide_delete => true if @app_dialog or @resources.any? %>
</div>
